import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';
import { NavbarComponent } from './navbar/navbar.component';
import { FooterComponent } from './footer/footer.component';
import { SearchComponent } from './search/search.component';
import { CarouselComponent } from './carousel/carousel.component';
import { ProductComponent } from './product/product.component';
import { DtarsComponent } from './dtars/dtars.component';
import { ProductDetailComponent } from './product-detail/product-detail.component';
import { HomeComponent } from './home/home.component';
import {RouterModule, Routes} from '@angular/router';
import {ProductService} from './shared/product.service';

// 路由
const routeConfig: Routes = [
  {path: '', component: HomeComponent},
  {path: 'product/:productId', component: ProductDetailComponent}
];


@NgModule({// 声明一个模块
  declarations: [// 模块里面有什么东西
     AppComponent, NavbarComponent, FooterComponent, SearchComponent, CarouselComponent, ProductComponent, DtarsComponent, ProductDetailComponent, HomeComponent//有一个组件
  ],
  imports: [// 声明了这个模块依赖什么模块
    BrowserModule, // 必选模块,浏览器的
    FormsModule, // 处理表单的模块
    HttpModule, // http模块

    // 路由
    RouterModule.forRoot(routeConfig)
  ],
  providers: [ProductService], // 声明模块提供了什么服务,只能声明服务
  bootstrap: [AppComponent]// 什么了模块的主组件是什么
})
export class AppModule { // 模块类

}
